import java.util.Observable;
import java.util.Observer;

public class GraphObserver implements Observer
{
    public void update(NumberGenerator generator)
    {
        System.out.print("GraphObserver:");
        int count = generator.getNumber();
        for (int i = 0; i < count; i++)
        {
            System.out.print("*");
        }
        System.out.println("");
        try
        {
            Thread.sleep(100);
        }
        catch (InterruptedException e)
        {
        }
    }

    @Override
    public void update(Observable o, Object arg)
    {
        RandomNumberGenerator generator = (RandomNumberGenerator) o;
        System.out.print("GraphObserver:");
        int count = generator.getNumber();
        for (int i = 0; i < count; i++)
        {
            System.out.print("*");
        }
        System.out.println("");
        try
        {
            Thread.sleep(100);
        }
        catch (InterruptedException e)
        {
        }
    }
}
